//
//  UIResponder+FirstResponder.m
//  KeyboardManager
//
//  Created by 唐可雄 on 2018/7/31.
//  Copyright © 2018年 swustyc. All rights reserved.
//

#import "UIResponder+FirstResponder.h"

static __weak id __currentResponder = nil;

@implementation UIResponder (FirstResponder)

+ (id)currentResponder {
    __currentResponder = nil;
    [[UIApplication sharedApplication] sendAction:@selector(findFirstResponder:)
                                               to:nil
                                             from:nil
                                         forEvent:nil];
    return __currentResponder;
}

- (void)findFirstResponder:(id)sender {
    __currentResponder = self;
    if ([__currentResponder isKindOfClass:NSClassFromString(@"UIWebBrowserView")]) {
        __currentResponder = nil;
    }
}

@end
